using System;
using System.Collections.Generic;
using System.Text;

namespace Umdf.ComInterop
{
    static class ComHResults
    {
        public const int E_UNEXPECTED = unchecked((int) 0x8000FFFF);
        public const int E_INVALIDARG = unchecked((int) 0x80070057);
        public const int S_OK = 0;
        public const uint FACILITY_WIN32 = 7;

        public static int HResultFromWin32(int win32ErrorCode)
        {
            return win32ErrorCode <= 0 ? win32ErrorCode : (int)(win32ErrorCode & (int)0x0000FFFF) | (int)(FACILITY_WIN32 << 16) | unchecked((int) 0x80000000);
        }
    }
}
